//全局函数区域
#include<stdio.h>

//程序1
//实现比大小并按照从小到大排序
void test1()
{
	int a, b, c, t;
	int*pa, *pb, *pc;//指针

	printf("请输入三个数：");
	scanf("%d%d%d", &a, &b, &c);
	
	pa = &a;//指针pa存放变量a的地址
	pb = &b;
	pc = &c;

	if (a > b)
	{

		t = *pa;
		*pa = *pb;
		*pb = t;


	}
	if (a > c)
	{
		t = *pa;
		*pa = *pc;
		*pc = t;
	}

	if (b > c)
	{
		t = *pb;
		*pb = *pc;
		*pc = t;

	}

	printf("%d <= %d <= %d\n", *pa, *pb, *pc);
}

//程序2
//验证尼科彻斯定理

int test2()
{
	int i, j, n, cube, sum = 0;

	printf("请输入一个整数：");
	scanf("%d", &n);
	cube = n * n * n;
	for (i = 1; i < cube; i += 2)
	{
		for (j = i; j < cube; j += 2)
		{
			sum += j;
			if (sum == cube)
			{
				if (j - i > 4)
				{
					printf("%d = %d + %d...+%d\n", cube, i, i + 2, j);
				}
				else
				{
					printf("%d = %d + %d + %d\n", cube, i, i + 2, i + 4);
				}
				goto FINDIT;
			}
			if (sum > cube)
			{
				sum = 0;
				break;
			}
		}
	}
	FINDIT:

	return 0;
}

//主程序
int main()
{
	/*
			索引					作用
			test1				实现比大小并按照从小到大排序
			test2				验证尼科彻斯定理
	*/
	test1();
	return 0;

}